<style lang="scss" scoped>
#cmain {
    .mainContent {
        min-height: 425px;
        border-radius: 10px;
        background: #fff;
        box-shadow: 0px 0px 15px 0px rgba(207, 207, 207, 1);
        padding-top: 10px;
        padding: 0px 30px;
        .table-title {
            height: 54px;
            line-height: 54px;
            margin-bottom: 20px;
            font-size: 16px;
            font-weight: 800;
            color: rgba(102, 102, 102, 1);
            border-bottom: 1px solid #dcdfe6;
        }
        .el-input--mini .el-input__inner {
            width: 202px;
        }
        .smok-drink .el-input__inner {
            width: 100%;
        }
        #my-table-title {
            height: 50px;
            line-height: 50px;
            text-align: center;
            background: #eef1f6;
            font-size: 14px;
            color: #2b3245;
        }
        .MyMainTable {
            padding: 10px 0px;
            border-bottom: 1px solid #eef1f6;
            .el-col {
                text-align: center;
            }
            .el-icon-plus:before {
                color: #337aba;
                font-size: 20px;
                font-weight: 800;
                cursor: pointer;
            }
            .el-icon-minus:before {
                color: #e51c23;
                font-size: 20px;
                font-weight: 800;
                cursor: pointer;
            }
            .el-form-item--mini.el-form-item {
                margin-bottom: 1px !important;
            }
            .el-form-item--mini .el-form-item__content {
                margin-left: 0px !important;
            }
            .el-input--mini .el-input__inner {
                width: 100%;
            }
        }
    }
}
</style>

<template>
    <div id="cmain" class="family-tree-mask" v-loading="loading" element-loading-text="数据加载中，请稍等......">
        <div class="mainContent">

            <el-form ref="datas" :model="datas" size="mini" label-width="200px" label-position="left">
                <!--临床与治疗信息  -->
                <div class="table-title">临床与治疗信息</div>
                <el-row type="flex" justify="space-around">
                    <el-col :span="12" :offset="3">
                        <el-form-item label="组织病理类型">
                            <el-select v-model="datas.pathology_type" placeholder="请选择病理类型">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="肾透明细胞癌" value="1"></el-option>
                                <el-option label="低度恶性潜能的房性囊性肾肿瘤" value="2"></el-option>
                                <el-option label="Ⅰ型乳头状肾细胞癌" value="3"></el-option>
                                <el-option label="Ⅱ型乳头状肾细胞癌" value="4"></el-option>
                                <el-option label="嫌色细胞肾细胞癌" value="5"></el-option>
                                <el-option label="杂合性嗜酸细胞/嫌色细胞肾肿瘤" value="6"></el-option>
                                <el-option label="集合管癌" value="7"></el-option>
                                <el-option label="髓质癌" value="8"></el-option>
                                <el-option label="未分类肾细胞癌" value="9"></el-option>
                                <el-option label="乳头状腺瘤" value="10"></el-option>
                                <el-option label="后肾性腺瘤" value="11"></el-option>
                                <el-option label="幼年性囊性肾病" value="12"></el-option>
                                <el-option label="透明细胞肉瘤" value="13"></el-option>
                                <el-option label="肾横纹肌样瘤" value="14"></el-option>
                                <el-option label="血管平滑肌脂肪瘤" value="15"></el-option>
                                <el-option label="血管母细胞瘤" value="16"></el-option>
                                <el-option label="混合性上皮间质肿瘤" value="17"></el-option>
                                <el-option label="成人囊性肾" value="18"></el-option>
                                <el-option label="遗传性平滑肌瘤病肾癌相关肾细胞癌" value="19"></el-option>
                                <el-option label="MiT家族易位性肾细胞癌（包括Xp11和t(6;11)易位" value="20"></el-option>
                                <el-option label="SDH缺陷型肾细胞癌（琥珀酸脱氢酶缺失性肾细胞癌）" value="21"></el-option>
                                <el-option label="管状囊性肾细胞癌" value="22"></el-option>
                                <el-option label="获得性囊性肾疾病相关肾细胞癌" value="23"></el-option>
                                <el-option label="透明细胞乳头状肾细胞癌" value="24"></el-option>
                                <el-option label="粘液小管状和梭形细胞癌" value="25"></el-option>
                                <el-option label="神经母细胞瘤相关性嗜酸细胞性肾细胞癌" value="26"></el-option>
                                <el-option label="甲状腺滤泡样肾细胞癌" value="27"></el-option>
                                <el-option label=" ALK（间变性淋巴瘤激酶）易位相关性肾细胞癌" value="28"></el-option>
                                <el-option label="伴平滑肌瘤样间质的肾细胞癌" value="29"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="临床分期cTNM"></el-form-item>
                        <el-form-item label="T">
                            <el-select v-model="datas.t"  @change="tnm()">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item,index) in t_data" :label="item" :value="item" :key="index"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="N">
                            <el-select v-model="datas.n"  @change="tnm()">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item,index) in n_data" :label="item" :value="item" :key="index"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="M">
                            <el-select v-model="datas.m"  @change="tnm()">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item,index) in m_data" :label="item" :value="item" :key="index"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="临床分期结果">
                            <div style="height40px;line-height40px;">{{this.datas.tnm_result}}</div>
                        </el-form-item>
                        <el-form-item label="病理分期pTNM"></el-form-item>
                        <el-form-item label="T">
                            <el-select v-model="datas.pt"  @change="ptnm()">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item,index) in p_data" :label="item" :value="item" :key="index"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="N">
                            <el-select v-model="datas.pn"  @change="ptnm()">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item,index) in n_data" :label="item" :value="item" :key="index"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="M">
                            <el-select v-model="datas.pm"  @change="ptnm()">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item,index) in m_data" :label="item" :value="item" :key="index"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="病理分期结果">
                            <div style="height40px;line-height40px;">{{this.datas.ptnm_result}}</div>
                        </el-form-item>
                        <el-form-item label="单侧多灶性">
                            <el-radio-group v-model="datas.umbc">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="双侧患癌">
                            <el-radio-group v-model="datas.bilateral_cancer">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="双侧患癌年龄" v-if="datas.bilateral_cancer==1">
                            <el-input v-model="datas.opposite_cancer_age"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="手术">
                            <el-select v-model="datas.operative_type">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="根治性肾切除" value="1"></el-option>
                                <el-option label="保留肾单位切除" value="2"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="是否进行过化疗">
                            <el-radio-group v-model="datas.chemotherapy">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="是否进行过放疗">
                            <el-radio-group v-model="datas.radiotherapy">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="细胞因子治疗">
                            <el-select v-model="datas.cytokine_therapy">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="根治性肾切除" value="1"></el-option>
                                <el-option label="保留肾单位切除" value="2"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="是否进行过靶向治疗">
                            <el-radio-group v-model="datas.targeted_therapy">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="是否进行过免疫治疗">
                            <el-radio-group v-model="datas.immunological_therapy">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="具体信息" v-if="datas.immunological_therapy==1">
                            <el-input v-model="datas.it_drug_name"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <!-- 遗传性肿瘤综合征表型信息 -->
                <div class="table-title">遗传性肿瘤综合征表型信息</div>
                <el-row type="flex" justify="space-around">
                    <el-col :span="12" :offset="3">
                        <el-form-item label="患有前额斑块">
                            <el-radio-group v-model="datas.noForehead">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="鲛鱼皮斑（结缔组织痣）">
                            <el-radio-group v-model="datas.noShagreen">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="室管膜下结节">
                            <el-radio-group v-model="datas.noSub">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="错构瘤性直肠息肉">
                            <el-radio-group v-model="datas.noPreP">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="“斑驳状”皮肤改变">
                            <el-radio-group v-model="datas.noMSC">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="非肾脏错构瘤">
                            <el-radio-group v-model="datas.noNRHo">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="视网膜色素缺失斑块">
                            <el-radio-group v-model="datas.noPD">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="自发性气胸伴双侧肺囊肿">
                            <el-radio-group v-model="datas.bpc">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="色素脱失斑">
                            <el-radio-group v-model="datas.pigmentation">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="个数" v-if="datas.pigmentation==1">
                            <el-input v-model="datas.pigmentation_number"></el-input>
                        </el-form-item>
                        <el-form-item label="脑皮质结节">
                            <el-radio-group v-model="datas.noCorT">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="牙釉质凹陷">
                            <el-radio-group v-model="datas.noEnamel">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="骨囊肿">
                            <el-radio-group v-model="datas.noBC">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="多发性肾囊肿">
                            <el-radio-group v-model="datas.noMRC">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="脑白质辐射状移行线">
                            <el-radio-group v-model="datas.noWMB">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="Birt–Hogg– Dubé相关的面部／躯干丘疹">
                            <el-radio-group v-model="datas.trunk_pimples">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="个数" v-if="datas.trunk_pimples==1">
                            <el-input v-model="datas.trunk_pimples_num"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <!-- 基因检测信息 -->
                <div class="table-title">基因检测信息</div>
                <div id="my-table-title">
                    <el-row display="flex" align="middle" justify="space-between">
                        <el-col span="3">操作</el-col>
                        <el-col span="4">基因</el-col>
                        <el-col span="4">转录本号</el-col>
                        <el-col span="4">变异位点</el-col>
                        <el-col span="3">检测类型</el-col>
                        <el-col span="3">功能改变</el-col>
                        <el-col span="3">突变类型</el-col>
                    </el-row>
                </div>

                <div class="MyMainTable" v-for="(item,index) in datas.results" :key="item.id">
                    <el-row>
                        <el-col span="3">
                            <i class="el-icon-plus" @click="addGenejcInfo(index)"></i>
                            <i class="el-icon-minus" @click="deleteGenejcInfo(index)"></i>
                        </el-col>
                        <el-col span="4">
                            <el-form-item>
                                <el-input v-model="item.detection_result_gene" placeholder="只能输入大写字母和数字"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label-width="0">
                                <el-input v-model="item.detection_result_trans" placeholder="请输入转录本号"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label-width="0">
                                <el-input v-model="item.detection_result_varia" placeholder="请输入变异位点"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="3">
                            <el-form-item label-width="0">
                                <el-select v-model="item.assay_type">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option label="全基因组" value="1"></el-option>
                                    <el-option label="全外显子检测" value="2"></el-option>
                                    <el-option label="panel检测" value="3"></el-option>
                                    <el-option label="sanger测序" value="4"></el-option>
                                    <el-option label="MLPA" value="5"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col span="3">
                            <el-form-item label-width="0">
                                <el-select v-model="item.functional_change" v-show="item.functional_change != 6">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option label="错义突变" value="1"></el-option>
                                    <el-option label="无义突变" value="2"></el-option>
                                    <el-option label="移码突变" value="3"></el-option>
                                    <el-option label="同义突变" value="4"></el-option>
                                    <el-option label="剪接位点突变" value="5"></el-option>
                                    <el-option label="其他" value="6"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item v-if="item.functional_change==6" label-width="0">
                                <el-input v-model="item.other_function_change"></el-input>
                                <i class="el-icon-error" @click="shouFunctionalChange(index)"></i>
                            </el-form-item>
                        </el-col>
                        <el-col span="3">
                            <el-form-item label-width="0">
                                <el-select v-model="item.mutation_type">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option label="致病的" value="1"></el-option>
                                    <el-option label="可能致病的" value="2"></el-option>
                                    <el-option label="意义不明确的" value="3"></el-option>
                                    <el-option label="可能良性的" value="4"></el-option>
                                    <el-option label="良性的" value="5"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </div>

                <!-- 生活方式 -->
                <div class="table-title">生活方式</div>
                <el-row type="flex" justify="space-around">
                    <el-col :span="12" :offset="3">
                        <el-form-item label="吸烟">
                            <el-radio-group v-model="datas.smoking">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="吸烟频率" v-if="datas.smoking==1">
                            <el-row type="flex">
                                <el-col span="6">
                                    <el-input v-model="datas.smoking_cycle" style="width:50px;" class="smok-drink">
                                        <!-- <template slot="append"></template> -->
                                    </el-input>
                                    包/周&nbsp;&nbsp;X
                                </el-col>
                                <el-col span="12">
                                    <el-input v-model="datas.smoking_year" style="width:50px;" class="smok-drink">
                                        <!-- <template slot="append">年</template> -->
                                    </el-input>
                                    年
                                </el-col>
                            </el-row>
                        </el-form-item>
                        <el-form-item label="饮酒">
                            <el-radio-group v-model="datas.drink">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="饮酒频率" v-if="datas.drink==1">
                            <el-row type="flex">
                                <el-col span="12">
                                    <el-input v-model="datas.drink_cycle" style="width:50px;" class="smok-drink">
                                        <!-- <template slot="append">次/周</template> -->
                                    </el-input>
                                    次/周
                                </el-col>
                            </el-row>
                        </el-form-item>
                        <el-form-item label="高脂高红肉类饮食">
                            <el-radio-group v-model="datas.fatty_meat">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="每日蔬菜摄入量">
                            <el-select v-model="datas.vegetable_consum">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="≥500mg" value="1"></el-option>
                                <el-option label="＜500mg" value="2"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="每日运动消耗量">
                            <el-select v-model="datas.dec">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="基本无运动量" value="1"></el-option>
                                <el-option label="30-50大卡" value="2"></el-option>
                                <el-option label="50-100大卡" value="3"></el-option>
                                <el-option label="100-200大卡" value="4"></el-option>
                                <el-option label="200-300大卡" value="5"></el-option>
                                <el-option label="＞300大卡" value="6"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="体重(kg)">
                            <el-input v-model="datas.weight" @change="getBmi"></el-input>
                        </el-form-item>
                        <el-form-item label="身高(cm)">
                            <el-input v-model="datas.height" @change="getBmi"></el-input>
                        </el-form-item>
                        <el-form-item label="BMI">
                            <div>{{ datas.bmi }}</div>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-card class="box-card footer-card">
                    <div slot="header" class="clearfix">
                        <Button style="float: right; margin-left:20px;" @click="onClose">取消</Button>
                        <Button type="primary" style="float: right;" @click="onSave">保存</Button>
                    </div>
                </el-card>

            </el-form>
        </div>
    </div>
</template>
<script>
import { getCookie } from "common/js/cookie.js";
import { familyTree } from "api/basic/familyTree/familyTree.js";
export default {
    name: "sa", //肾癌
    data() {
        return {
            t_data: ["TX", "T0", "T1", "T2", "T3", "T4"],
            n_data: ["NX", "N0", "N1"],
            m_data: ["M0", "M1"],
            p_data: ["pTX", "pT0", "pT1", "pT2", "pT3", "pT4"],
            datas: {
                pathology_type: "", //组织病理类型
                t: "",
                n: "",
                m: "",
                tnm_result: "",
                pt: "",
                pn: "",
                pm: "",
                ptnm_result: "",
                umbc: "2", //单侧多灶性
                bilateral_cancer: "2", //双侧患癌
                opposite_cancer_age: "", //双侧患癌年龄
                immunological_therapy: "2", //免疫治疗
                it_drug_name: "", //免疫治疗具体信息
                radiotherapy: "2", //放疗
                targeted_therapy: "2", //是否进行靶向治疗
                chemotherapy: "2", //化疗
                operative_type: "", //手术
                cytokine_therapy: "", //细胞因子治疗
                noForehead: "2", //前额斑块
                noShagreen: "2", //鲛鱼皮斑（结缔组织痣）
                noSub: "2", //室管膜下结节
                noPreP: "2", //错构瘤性直肠息肉
                noMSC: "2", //“斑驳状”皮肤改变
                noNRHo: "2", //非肾脏错构瘤
                noPD: "2", //视网膜色素缺失斑块
                bpc: "2", //自发性气胸伴双侧肺囊肿
                pigmentation: "2", //色素脱失斑
                pigmentation_number: "", //色素脱失斑个数
                noCorT: "2", //脑皮质结节
                noEnamel: "2", //牙釉质凹陷
                noBC: "2", //骨囊肿
                noMRC: "2", //多发性肾囊肿
                noWMB: "2", //脑白质辐射状移行线
                trunk_pimples: "2", //Birt–Hogg– Dubé相关的面部／躯干丘疹
                trunk_pimples_num: "",

                results: [
                    {
                        assay_type: "",
                        detection_result_gene: "",
                        detection_result_trans: "",
                        detection_result_varia: "",
                        functional_change: "",
                        other_function_change: "",
                        mutation_type: ""
                    }
                ],

                smoking: "2",
                drink: "2",
                vegetable_consum: "",
                fatty_meat: "2",
                dec: "",
                drink_cycle: "",
                bmi: "",
                height: "",
                weight: "",
                smoking_cycle: "",
                smoking_year: ""
            },
            loading: true,
            postParams: {}
        };
    },
    computed: {
     
    },
    components: {},
    created() {},
    watch: {
        datas: {
            // 不当选，清空相关联值
            handler: function(newVal) {
                // 对侧患癌年龄
                if (newVal.bilateral_cancer != 1) {
                    this.datas.chemotherapy_number = "";
                }
                // 免疫治疗
                if (newVal.immunological_therapy != 1) {
                    this.datas.it_drug_name = "";
                }

                // 色素脱失斑
                if (newVal.pigmentation != 1) {
                    this.datas.pigmentation_number = "";
                }
                // Birt–Hogg– Dubé相关的面部／躯干丘疹
                if (newVal.trunk_pimples != 1) {
                    this.datas.trunk_pimples_num = "";
                }
                // 吸烟
                if (newVal.smoking != 1) {
                    this.datas.smoking_cycle = "";
                    this.datas.smoking_year = "";
                }
                // 饮酒
                if (newVal.drink != 1) {
                    this.datas.cut_tuboovarian_age = "";
                }
            },
            deep: true
        }
    },
    mounted() {
        document.title = "肾癌辅助信息";
        // 获取辅助信息
        this.postParams.userId = getCookie("userid");
        this.postParams.familyTreeId = M.url().familyTreeId;
        this.postParams.familyUserId = M.url().current_personid;
        this.postParams.cancerId = M.url().cancerId;
        console.log(this.postParams);
        familyTree
            .findOneFromCancer(this.postParams)
            .then(res => {
                if (res.returnCode == 0) {
                    if (res.data && res.data.familyCancer) {
                        this.datas = { ...res.data.familyCancer };
                        this.$Message.success("数据加载成功");
                    }
                } else {
                    this.$Message.error("数据加载失败");
                }
                this.loading = false;
            })
            .catch(error => {
                this.loading = false;
            });
    },
    methods: {
        onClose() {
            window.close();
        },
        onSave() {
            this.loading = true;
            this.postParams.familyCancer = this.datas;
            familyTree
                .saveOrUpdateCancerForm(this.postParams)
                .then(res => {
                    if (res.returnCode == 0) {
                        this.$Message.success("数据保存成功");
                    } else {
                        this.$Message.error("数据保存失败");
                    }
                    this.loading = false;
                })
                .catch(err => {
                    this.loading = false;
                });
        },
        addGenejcInfo(index) {
            console.log(index);
            let obj = {
                detection_result_gene: "", //基因
                detection_result_trans: "", //转录本号
                detection_result_varia: "", //变异位点
                assay_type: "", //检测类型
                functional_change: "", //功能改变
                other_function_change: "", //其他
                mutation_type: "" //突变类型
            };
            ++index;
            this.datas.results.splice(index, 0, obj);
        },
        deleteGenejcInfo(index) {
            if (this.datas.results.length <= 1) {
                this.$Message.info("最少为一条，不可删除了");
                return;
            }
            this.datas.results.splice(index, 1);
        },
        shouFunctionalChange(index) {
            this.datas.results[index].functional_change = "";
            this.datas.results[index].other_function_change = "";
        },
        getBmi() {
            let bmi =
                Math.round(
                    this.datas.weight /
                        Math.pow(this.datas.height / 100, 2) *
                        100
                ) / 100;
            if (isNaN(bmi) || bmi == Infinity) {
                this.datas.bmi = "";
            } else {
                this.datas.bmi = bmi;
            }
        },
        tnm() {
            //
            this.ShowState(this.datas.t, this.datas.n, this.datas.m, 1);
        },
        ptnm() {
            this.ShowState(this.datas.pt, this.datas.pn, this.datas.pm, 2);
        },
        ShowState: function(t, n, m, type) {
            let flag = t + n + m;
            if (type == 1) {
                if (flag == "T1N0M0") {
                    //结果为一期
                    this.datas.tnm_result = flag + " " + "Ⅰ期";
                } else if (flag == "T2N0M0") {
                    //结果为二期
                    this.datas.tnm_result = flag + " " + "Ⅱ期";
                } else if ((t == "T4" && m == "M0") || m == "M1") {
                    //结果为四期
                    this.datas.tnm_result = flag + " " + "Ⅳ期";
                } else if (
                    flag == "T1N1M0" ||
                    flag == "T2N1M0" ||
                    flag == "T3N0M0" ||
                    flag == "T3N1M0"
                ) {
                    //结果为三期
                    this.datas.tnm_result = flag + " " + "Ⅲ期";
                } else {
                    //其他情况为无分期
                    this.datas.tnm_result = "无分期";
                }
            } else {
                if (flag == "pT1N0M0") {
                    //结果为一期
                    this.datas.ptnm_result = flag + " " + "Ⅰ期";
                } else if (flag == "pT2N0M0") {
                    //结果为二期
                    this.datas.ptnm_result = flag + " " + "Ⅱ期";
                } else if ((t == "pT4" && m == "M0") || m == "M1") {
                    //结果为四期
                    this.datas.ptnm_result = flag + " " + "Ⅳ期";
                } else if (
                    flag == "pT1N1M0" ||
                    flag == "pT2N1M0" ||
                    flag == "pT3N0M0" ||
                    flag == "pT3N1M0"
                ) {
                    //结果为三期
                    this.datas.ptnm_result = flag + " " + "Ⅲ期";
                } else {
                    //其他情况为无分期
                    this.datas.ptnm_result = "无分期";
                }
            }
        }
    }
};
</script>
 